package com.example.xpvideo.annotations;


import com.example.xpvideo.validator.IsFileConstraintValidator;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author : 洪俊新
 * @date : 2021/3/4 10:39
 * @description:
 */
@Documented
// 指定校验器
@Constraint(validatedBy = {IsFileConstraintValidator.class})
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE,
                ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
public @interface IsFile {
    String message() default "文件上传失败，请求错误";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    Class<?> file() default MultipartFile.class;
}
